﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Setting_add_user : System.Web.UI.Page
{
	LogicLayer mgr = new LogicLayer();

	protected string tip = "";

    protected void Page_Load(object sender, EventArgs e)
    {
		if (IsPostBack)
		{
			SYS_User usr = new SYS_User();
			usr.UserName = Request.Form["userName"];
			usr.Password = Request.Form["userpwd"];

			if (!mgr.IsUserNameRepeat(usr.UserName))
			{
				if (mgr.AddUser(usr, Request.Form["emplID"]))
					Response.Write("<script>window.opener.location.reload();window.close();</script>");
				else
					tip = "保存失败!";
			}
			else
				tip = "用户名重复，请填写其他的用户名!";
		}
    }
}